<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">


    <body>

        <ui:composition template="./adminTemplate.xhtml">

            <ui:define name="title">
                Add Banner
            </ui:define>

            <ui:define name="contain">
                <h:form>
                    <h2 class="ico_mug">Add Banner</h2>
                    <h:panelGrid columns="3" cellpadding="8px" cellspacing="10px" id="panel">
                        <h:outputLabel value="Title: " />
                        <p:inputText value="#{bannerBean.title}" id="title" requiredMessage="Please input title" required="true" style="width: 196px"/>
                        <p:message for="title"/>

                        <h:outputLabel value="Image: " />
                        <p:fileUpload value="#{bannerController.file}" mode="simple"/>  
                        &nbsp;

                        <h:outputLabel value="Website link: " />
                        <p:inputText value="#{bannerBean.link}" id="link" requiredMessage="Please input website link" required="true" style="width: 196px"/>
                        <p:message for="link"/>

                        <h:outputLabel value="Description: " />
                        <p:inputTextarea value="#{bannerBean.description}" id="description" rows="3" style="width: 196px" />
                        <p:message for="description"/>

                        &nbsp;
                        <p:column colspan="2">
                            <p:commandButton value="Submit" actionListener="#{bannerController.addBanner}" ajax="false" /> 
                            <p:commandButton type="reset" value="Reset" /> 
                        </p:column>
                    </h:panelGrid>
                    <p:messages autoUpdate="true" showDetail="true" showSummary="false" globalOnly="true"></p:messages> 
                </h:form> 
            </ui:define>

        </ui:composition>

    </body>
</html>
